﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using SchoolManagerMVC.BusinessAbstract.Interfaces;
using System.Web.Security;

namespace SchoolManagerMVC.Web.Models
{
    public class MembershipWrapper:IMembership
    {
        private MembershipCreateStatus createStatus;

        public MembershipCreateStatus createUser(string userName, string password, string email)
        {
            Membership.CreateUser(userName, password, email, null, null, true, null, out createStatus);
            return (createStatus);
        }

        public Guid getUserID(string username)
        {
            return (Guid)Membership.GetUser(username).ProviderUserKey;
        }

        public void setAuthCookie(string username, bool persist)
        {
            FormsAuthentication.SetAuthCookie(username, persist /* createPersistentCookie */);
        }

        public void addUserToRole(string username, string role)
        {
            Roles.AddUserToRole(username, role);
        }
    }
}